﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;

using SpiritAlight.SceneManagement;
namespace SpiritAlight.Stage
{
    public class StageManager
    {
        List<AObstacle> obstacleList = new List<AObstacle>();

        Texture2D BaseTexture;
        Tree tree;

        

        public StageManager()
        {
            BaseTexture = SceneManager.Content.Load<Texture2D>("Map/Field/woods");
            
            tree = new Tree(new Vector2(400.0f, 300.0f));
            tree.LoadContent();

            obstacleList.Add(tree);
        }

        public void AddObstacle(AObstacle obj)
        {
            obstacleList.Add(obj);
        }

        public void Draw()
        {
            foreach (var obj in obstacleList)
            {
                obj.Draw();
            }
        }

        public bool IsWall(Vector2 characterPosition, Vector2 chrSize)
        {
            foreach (var obj in obstacleList)
            {
                if (obj.IsIntersect(characterPosition, chrSize))
                    return true;
            }
            return false;
        }
    }
}
